package com.syx.service.impl;

import com.syx.dao.ProDao;
import com.syx.entity.Pro;
import com.syx.entity.User;
import com.syx.service.ProService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ProServiceImpl implements ProService {
    @Resource
    private ProDao proDao;

    @Override
    public List proList(Map map) {
        return proDao.proList(map);
    }

    @Override
    public User login(User user) {
        return proDao.login(user);
    }

    @Override
    public List baseList() {
        return proDao.baseList();
    }

    @Override
    public int add(Pro pro, Integer[] bids) {
        int i = proDao.add(pro);
        if (i>0){
            Map map = new HashMap();
            map.put("pid",pro.getPid());
            map.put("bids",bids);
            proDao.addpb(map);
        }
        return i;
    }
}
